package com.one.blocks.rbac.enums;

import com.one.blocks.common.enums.CodeEnum;
import com.one.blocks.common.valid.validator.EnumContainsValid;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author <a href="mailto:idler41@163.con">linfuxin</a> created on 2023-10-25 08:50:38
 */
@AllArgsConstructor
public enum RoleTypeEnum implements CodeEnum, EnumContainsValid<Integer> {

    /**
     * 系统管理员
     */
    ADMIN(100),

    /**
     * 普通角色
     */
    COMMON(0),
    ;

    @Getter
    final int code;


    @Override
    public boolean contains(Integer val) {
        return Arrays.stream(values()).anyMatch(i -> i.getCode() == val);
    }

}
